package com.scc.services;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.scc.entites.CategoriesEntity;
import com.scc.entites.DishEntity;
import com.scc.entites.dto.DishEntityDTO;
import com.scc.persistence.ICategorySetupDAO;

@Service
public class DishSetupAssembler implements IDishSetupAssembler
{
   @Autowired
   private ICategorySetupDAO categorySetupDAO;
   
   @Override
   public DishEntity assemble(DishEntityDTO dishDTO)
   {
      DishEntity result = new DishEntity();
      result.setCode(dishDTO.getCode());
      result.setDescription(dishDTO.getDescription());
      result.setName(dishDTO.getName());
      result.setDescription(dishDTO.getDescription());
      result.setWeight(dishDTO.getWeight());
      
      CategoriesEntity categoryFromDB = 
            categorySetupDAO.getCategory(dishDTO.getCategory());
      result.setCategory(categoryFromDB);
      return result;
   }

   @Override
   public DishEntityDTO assemble(DishEntity dish)
   {
      // TODO Auto-generated method stub
      return null;
   }
   
}
